<?php
 /*
 * 1626cms 投訴與建議
 * ============================================================================
 * 版權所有: 1626網絡，并保留所有權利。
 * 網站地址: http://www.1626.com；
 * ----------------------------------------------------------------------------
 * 這不是一個自由軟件！您只能在不用于商業目的的前提下對程序代碼進行修改和
 * 使用；不允許對程序代碼以任何形式任何目的的再發布。
 * ============================================================================
*/
define('IN_QISHI', true);
require_once('../data/config.php');
require_once('./include/admin_common.inc.php');
require_once(ADMIN_ROOT_PATH.'include/admin_feedback_fun.php');
!empty($_POST['perpage'])?(setcookie('perpage',intval($_POST['perpage']))).($perpage=intval($_POST['perpage'])):($perpage= !empty($_COOKIE['perpage'])? $_COOKIE['perpage'] :'10');
$act = !empty($_GET['act']) ? trim($_GET['act']) : 'suggest_list';
//意見和建議列表
if($act == 'suggest_list'){
require_once(ADMIN_ROOT_PATH.'include/page.class.php');
!empty($_GET['infotype']).(trim($_GET['infotype'])+0!=0)? $wheresqlarr['infotype']=trim($_GET['infotype']):'';
!empty($_GET['usertype']).(trim($_GET['usertype'])+0!=0)? $wheresqlarr['usertype']=trim($_GET['usertype']):'';
!empty($_GET['replyinfo']).(trim($_GET['replyinfo'])+0!=0)? $wheresqlarr['replyinfo']=trim($_GET['replyinfo']):'';
if (is_array($wheresqlarr))
{
$where_set=' WHERE';
foreach ($wheresqlarr as $key => $value)
{
$wheresql .=$where_set. $comma.'`'.$key.'`'.'=\''.$value.'\'';
$comma = ' AND ';
$where_set='';
}
}
$key=trim($_POST['key']);
!empty($key)?($wheresql=" WHERE username like '%{$key}%'"):'';
$total_sql="SELECT COUNT(*) AS num FROM ".table('feedback').$wheresql;
$total_val=get_total($total_sql);
$page = new page(array('total'=>$total_val, 'perpage'=>$perpage));
$currenpage=$page->nowindex;
$offset=($currenpage-1)*$perpage;
$list = get_feedback_list($offset,$perpage,$wheresql);
$smarty->assign('pageheader',"管理中心 - 意見和建議");
$smarty->assign('infotype',$_GET['infotype']);//照片人才
$smarty->assign('usertype',$_GET['usertype']);//照片審核狀態
$smarty->assign('replyinfo',$_GET['replyinfo']);//是否已回復
$smarty->assign('key',$key);//關鍵字POST
$smarty->assign('perpage',$perpage);//每頁顯示數量POST
$smarty->assign('list',$list);//列表
if ($total_val>$perpage)
{
$smarty->assign('page',$page->show(3));//分頁符
}
$smarty->display('admin_feedback_suggest_list.htm');
}
//刪除意見和建議
if($act == 'del_feedback'){
$yid =trim($_REQUEST['y_id'])?$_REQUEST['y_id']:showmsg("你沒有選擇項目！",1);
$delete =trim($_REQUEST['delete']);
$link[0]['text'] = "返回上一頁";
$link[0]['href'] = $_SERVER['HTTP_REFERER'];
$delete?(!del_feedback($yid)?showmsg("刪除失敗！",0):showmsg("刪除成功！",2,$link)):'';
}
//回復意見和建議
if($act == 'reply_feedback'){
$id =trim($_GET['id'])?$_GET['id']:showmsg("你沒有選擇項目！",1);
$smarty->assign('pageheader',"管理中心 - 管理中心 - 意見和建議 - 回復");
$smarty->assign('feedback',get_feedback_one($id));
$smarty->assign('url',$_SERVER["HTTP_REFERER"]);
$smarty->display('admin_feedback_suggest_reply.htm');
}
//保存回復意見和建議
if($act == 'reply_save'){
$setsqlarr['feedbacktime']=$timestamp;
$setsqlarr['reply']=trim($_POST['reply'])?trim($_POST['reply']):showmsg('您沒有填寫回復內容！',1);
$setsqlarr['replyinfo']=2;
$wheresql=" id='".intval($_POST['feedbackid'])."' ";
if (!updatetable(table('feedback'), $setsqlarr,$wheresql)) showmsg("保存失敗！",0);
$link[0]['text'] = "返回列表";
$link[0]['href'] = $_POST['url'];
echo ("<script>window.parent.leftFrame.location.href='admin_index.php?act=left';</script>");
showmsg("操作成功！",2,$link);
}
//投訴信息
if($act == 'report_list'){
require_once(ADMIN_ROOT_PATH.'include/page.class.php');
require_once(ADMIN_ROOT_PATH.'include/admin_member_personal_fun.php');
$total_sql="SELECT COUNT(*) AS num FROM ".table('report').$wheresql;
$total_val=get_total($total_sql);
$page = new page(array('total'=>$total_val, 'perpage'=>$perpage));
$currenpage=$page->nowindex;
$offset=($currenpage-1)*$perpage;
$list = get_report_list($offset,$perpage,$wheresql);
$smarty->assign('pageheader',"管理中心 - 投訴信息");
$smarty->assign('perpage',$perpage);//每頁顯示數量POST
$smarty->assign('list',$list);//列表
if ($total_val>$perpage)
{
$smarty->assign('page',$page->show(3));//分頁符
}
$smarty->display('admin_report_list.htm');
}
//刪除投訴信息
if($act == 'del_report'){
$yid =trim($_REQUEST['y_id'])?$_REQUEST['y_id']:showmsg("你沒有選擇項目！",1);
$delete =trim($_REQUEST['delete']);
$link[0]['text'] = "返回上一頁";
$link[0]['href'] = $_SERVER['HTTP_REFERER'];
$delete?(!del_report($yid)?showmsg("刪除失敗！",0):showmsg("刪除成功！",2,$link)):'';
}
?>
